package cn.rongdao.jrkabao.model.cashadvance;

import com.mifengkong.frtools.http.request.HttpFunction;
import com.mifengkong.frtools.util.FRString;

import cn.rongdao.jrkabao.bean.cashadvance.CashDebitBean;
import cn.rongdao.jrkabao.model.api.BaseKaMaoModel;
import io.reactivex.Observable;
import io.reactivex.Observer;

/**
 * Created by jack on 2017/11/7
 */

public class CashDebitModel extends BaseKaMaoModel {

    public static CashDebitModel getInstance() {
        return getPresent(CashDebitModel.class);
    }

    public void execute(boolean isJiFen,String orderNum, String institutionId, String cvn2, String termOfValidate, String verifyDataMsg, Observer<CashDebitBean> observer) {
        addParamStrings("is_jifen", isJiFen ? "1" : "0");
        addParamStrings("order_no", FRString.valueOf(orderNum));
        addParamStrings("institution_id", FRString.valueOf(institutionId));
        addParamStrings("cvn2", FRString.valueOf(cvn2));
        addParamStrings("valid_date", FRString.valueOf(termOfValidate));
        addParamStrings("validate_code", FRString.valueOf(verifyDataMsg));
        Observable<CashDebitBean> observable = mServletApi.debit(mParams).map(new HttpFunction<CashDebitBean>());
        toSubscribe(observable, observer);
    }
}